Repository navigation
Conversation
schedule() unconditionally yields the CPU on every 10th RPC iteration. Under CPU saturation this stalls the grant machinery: the timer thread yields to other runnable threads, falls behind on grant processing, senders back up waiting for grants, and the next timer pass covers even more RPCs — a feedback loop that can collapse throughput to near-zero. cond_resched() yields only when need_resched() is set, preserving the intent of the comment (give other threads a chance) without gratuitously stalling the timer under load. Identified by code inspection; see issue PlatformLab#157. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
schedule()in the per-RPC iteration loop insidehoma_timer()unconditionally yields the CPU every 10 RPCs. Under CPU saturation this stalls the grant machinery — the timer thread yields to other runnable threads, falls behind on processing, senders back up waiting for grants, and the next timer pass covers even more RPCs. This feedback loop can collapse Homa throughput to near-zero without a hard kernel hang.cond_resched()yields only whenneed_resched()is set. If nothing is waiting for the CPU it returns immediately, preserving the intent of the existing comment ("give other threads a chance") without gratuitously stalling the timer under load.Change
One line. No behaviour change except under CPU contention.
Context
Identified by code inspection during a study of Homa's grant machinery under concurrent workloads on kernel 7.0.14-23-pve (Proxmox). We did not directly reproduce a livelock — bench runs topped out at N=8 concurrent sockets — but
schedule()in a hot kernel loop over potentially many RPCs is a well-known anti-pattern. See issue #157 for fuller discussion.This fix was identified and implemented by Claude Sonnet 4.6 (Anthropic's AI assistant) with minimal human direction. Dean Ross-Smith provided the hardware environment and research direction; the code inspection, root-cause analysis, and patch were AI-generated.